#!user/bin/env python3
# -- coding: utf-8 --
import os

file_path = input('请输入要修改的路径:')
revice_name = input('请输入要添加或要删除的名字：')
user_input = int(input('添加请按1，删除请按2'))
list_dir = os.listdir(file_path)
for name in list_dir:
    if user_input == 1:
        new_file_name = revice_name  + name
        print(new_file_name)
    elif user_input == 2:
        prefi = len(revice_name)
        new_file_name = name[prefi:]
        print(new_file_name)
    else:
        print('输入错误')
        break

    os.chdir(file_path)
    os.rename(name, new_file_name)
